import java.awt.GridLayout;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.text.DecimalFormat;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;


public class HelpTextWindow extends JFrame {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	HelpTextWindow(){
		showHelp("help.txt");
	}
	public void showHelp(String txtFile){
		this.setTitle("OBScomm-help");
		
		getContentPane().setLayout(new GridLayout(1,1,0,0));
		
		String str = new String("");
		try {
			InputStream is = getClass().getResourceAsStream(txtFile);
			BufferedReader reader = new BufferedReader(new InputStreamReader(is));
			String line;
			while((line = reader.readLine()) != null) {
				str += line;
				str += "\n";
			}
		} catch(Exception e) {
			e.printStackTrace();
		}
		JTextArea   ta = new JTextArea(str, 1, 1);
		ta.setEditable(false);
		
		ta.setText(str);
		JScrollPane sp = new JScrollPane(ta);
		sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
		getContentPane().add(sp);

		
	}

}
